#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>
using namespace std;
bool back(string& st1)
{
	string::iterator it = st1.begin();
	string::iterator rit = st1.begin() + st1.size() - 1;
	while (it < rit) {
		if (*it == *rit)
		{
			it++;
			rit--;
		}
		else {
			return false;
		}
	}
	return true;
}
int main() {
	string st1;
	string st2;
	int count = 0;
	while (cin >> st1 >> st2) {
		string::iterator it1 = st1.begin();
		string::iterator it2 = st2.begin();
		while (it2 != st2.end()) {
			while (it1 != st1.end() + 1) {
				it1 = st1.insert(it1, *it2);
				if (back(st1) == true)
				{
					count++;
				}
				//cout<<st1<<endl;
				it1 = st1.erase(it1);
				it1++;
			}
			it2++;
		}
		cout << count;
	}
}
